﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SunshineAirlines.UserControls
{
    public partial class flightStop : UserControl
    {
        public flightStop()
        {
            InitializeComponent();
        }

        private string depCity;
        private string depTime;
        private string tsfCity;
        private string tsfTime_1;
        private string tsfTime_2;
        private string arrCity;
        private string arrTime;
        private int waitTime;
        private int totalTime;
        private string cabinType;
        private double price;
        private int availableTickets;
        private string fltNum_1;
        private string fltNum_2;
        private double delayRate_1;
        private double delayRate_2;

        public string DepCity
        {
            get
            {
                return depCity;
            }

            set
            {
                depCity = value;
                lblDEPct.Text = depCity;
            }
        }

        public string DepTime
        {
            get
            {
                return depTime;
            }

            set
            {
                depTime = value;
                lblDEPtime.Text = string.Format(lblDEPtime.Text, Convert.ToDateTime(depTime));
            }
        }

        public string TsfCity
        {
            get
            {
                return tsfCity;
            }

            set
            {
                tsfCity = value;
                lblTSFct_1.Text = tsfCity;
                lblTSFct_2.Text = tsfCity;
                //lblTSFtime.Text = string.Format("{1}h {2}m Transfer in {0}", tsfCity, 0, 0);
            }
        }

        public string TsfTime_1
        {
            get
            {
                return tsfTime_1;
            }

            set
            {
                tsfTime_1 = value;
                lblTSFtime_1.Text = string.Format(lblTSFtime_1.Text, Convert.ToDateTime(tsfTime_1));
            }
        }

        public string TsfTime_2
        {
            get
            {
                return tsfTime_2;
            }

            set
            {
                tsfTime_2 = value;
                lblTSFtime_2.Text = string.Format(lblTSFtime_2.Text, Convert.ToDateTime(tsfTime_2));
            }
        }

        public string ArrCity
        {
            get
            {
                return arrCity;
            }

            set
            {
                arrCity = value;
                lblARRct.Text = arrCity;
            }
        }

        public string ArrTime
        {
            get
            {
                return arrTime;
            }

            set
            {
                arrTime = value;
                lblARRtime.Text = string.Format(lblARRtime.Text, Convert.ToDateTime(arrTime));
            }
        }

        public int WaitTime
        {
            get
            {
                return waitTime;
            }

            set
            {
                waitTime = value;
                TimeSpan ts = TimeSpan.FromMinutes(waitTime);
                lblTSFtime.Text = string.Format("{1}h {2}m Transfer in {0}", tsfCity, ts.Hours, ts.Minutes);
            }
        }

        public int TotalTime
        {
            get
            {
                return totalTime;
            }

            set
            {
                totalTime = value;
                TimeSpan ts = TimeSpan.FromMinutes(totalTime);
                lblTotalTime.Text = string.Format(lblTotalTime.Text, ts.Hours, ts.Minutes);
            }
        }

        public string CabinType
        {
            get
            {
                return cabinType;
            }

            set
            {
                cabinType = value;
                lblCabin.Text = cabinType;
            }
        }

        public double Price
        {
            get
            {
                return price;
            }

            set
            {
                price = value;
                lblPrice.Text = string.Format(lblPrice.Text, price);
            }
        }

        public int AvailableTickets
        {
            get
            {
                return availableTickets;
            }

            set
            {
                availableTickets = value;
                lblAvlTkts.Text = string.Format(lblAvlTkts.Text, availableTickets);
            }
        }

        public string FltNum_1
        {
            get
            {
                return fltNum_1;
            }

            set
            {
                fltNum_1 = value;
                lblFLTnum_1.Text = string.Format("Flight {0}", fltNum_1);
            }
        }

        public string FltNum_2
        {
            get
            {
                return fltNum_2;
            }

            set
            {
                fltNum_2 = value;
                lblFLTnum_2.Text = string.Format("Flight {0}", fltNum_2);
            }
        }

        public double DelayRate_1
        {
            get
            {
                return delayRate_1;
            }

            set
            {
                delayRate_1 = value;
                if (delayRate_1 > 0) lblFLTnum_1.Text += string.Format(" ({0:P})", delayRate_1);
            }
        }

        public double DelayRate_2
        {
            get
            {
                return delayRate_2;
            }

            set
            {
                delayRate_2 = value;
                if (delayRate_2 > 0) lblFLTnum_2.Text += string.Format(" ({0:P})", delayRate_2);
            }
        }
    }
}
